Skip to main content

⚡ LightGBM

Created by Microsoft, LightGBM is XGBoost's biggest rival.

🌳 Growing Leaves

It grows leaf-wise instead of level-wise, making it incredibly fast but prone to overfitting if not careful.

🐍 Python Implementation

# pip install lightgbm
import lightgbm as lgb
import numpy as np

X = np.array([[0, 0], [1, 1], [9, 9], [10, 10]])
y = np.array([0, 0, 1, 1])

model = lgb.LGBMClassifier(n_estimators=100)
model.fit(X, y)

print("Prediction:", model.predict([[8, 8]]))